home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / mui / bcc.lha / BCC / Examples / JoyTest / MUI_Main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-08  |  1020 b   |  49 lines

  1. #include <proto/exec.h>
  2. #include <proto/dos.h>
  3. #include <proto/intuition.h>
  4. #include <proto/graphics.h>
  5. #include <proto/lowlevel.h>
  6.  
  7. #include "initcl.h"
  8. #include "App.h"
  9.  
  10. #include <libraries/bcc.h>
  11.  
  12. struct Library *MUIMasterBase;
  13. Object *app;
  14.  
  15. extern ULONG __stack = 10000;
  16. extern ULONG __OSlibversion = 36;
  17.  
  18. main()
  19. {
  20.     int running = TRUE, ret = RETURN_OK;
  21.     ULONG signals, joy;
  22.     
  23.     if( MUIMasterBase = OpenLibrary( MUIMASTER_NAME, 12 ) ) {
  24.         if( _initclasses() ) {
  25.             if( app = NewObject( cl_App->mcc_Class, NULL, TAG_DONE ) ) {
  26.  
  27.                 while (running)
  28.                 {
  29.                     switch( DoMethod( app, MUIM_Application_Input, &signals ) ) {
  30.                         case MUIV_Application_ReturnID_Quit:
  31.                             running = FALSE;
  32.                             break;
  33.                     }
  34.                 
  35.                     if( running && signals ) WaitTOF();
  36.                     joy = ReadJoyPort( BCC_XGet( app, MUIA_App_Port ) );
  37.                     set( app, MUIA_App_State, joy );
  38.  
  39.                 }
  40.                 MUI_DisposeObject( app );
  41.             }
  42.             _freeclasses();
  43.         } else ret = RETURN_ERROR;
  44.         CloseLibrary( MUIMasterBase );
  45.     } else ret = RETURN_ERROR;
  46.     
  47.     return ret;
  48. }
  49.